package com.example.petshop.service.impl;

import com.example.petshop.entity.Pet;
import com.example.petshop.mapper.PetMapper;
import com.example.petshop.service.PetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PetServiceImpl implements PetService {

    @Autowired
    private PetMapper petMapper;

    @Override
    public List<Pet> getAllPets() {
        return petMapper.getAllPets();
    }

    @Override
    public Pet getPetById(int petId) {
        return petMapper.getPetById(petId);
    }
    @Override
    public void createPet(Pet pet) {
        // 使用ShopMapper插入新的商店记录
        petMapper.insert(pet);
    }

    @Override
    public void deletePet(Integer petId) {
        petMapper.deleteById(petId);
    }

    @Override
    public void updatePet(Pet pet) {
        // 使用ShopMapper更新商店记录
        petMapper.updatePet(pet);
    }
}
